<?php
session_start();

if(isset($_SESSION['admin_id'])) {
    include "../../include/dbFunctions.php";
    $file = "../../upload/".$_GET['file'];
    if (unlink($file)) {
        $_SESSION['mes']='File has been removed sucessfully';
    }
    $cid=$_SESSION['cid'];
    $query="UPDATE class
            SET class_student_list = ''
            WHERE class_id = $cid";
    $result = executeQuery($query);
    if ($result!=0) {
        $_SESSION['mes'].="The record has been updated successfully";
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    } else {
        $_SESSION['mes'].="Error! Please try again";
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    }
}else {
    header("Location: ../include/login.html");
}
?>